package com.gzwh.weblib.basic;

import com.alibaba.fastjson.JSONArray;
import com.gzwh.weblib.bean.CountCateToFoodModel;
import com.gzwh.weblib.bean.DMenuModel;
import com.gzwh.weblib.bean.DTreeCategoryModel;
import com.gzwh.weblib.bean.DinnerFood;
import com.gzwh.weblib.bean.DinnerNzVerify;
import com.gzwh.weblib.bean.DinnerOrderModel;
import com.gzwh.weblib.bean.DinnerShopStaff;
import com.gzwh.weblib.bean.HandSetDevicesModel;
import com.gzwh.weblib.bean.MenuFoodModel;
import com.gzwh.weblib.bean.NzDinnerQrcode;
import com.gzwh.weblib.bean.NzDinnerRegion;
import com.gzwh.weblib.bean.NzProductAttrModel;
import com.gzwh.weblib.bean.NzProductCategory;
import com.gzwh.weblib.bean.NzStore;
import com.gzwh.weblib.bean.PayCheckModel;
import com.gzwh.weblib.bean.Result;
import com.gzwh.weblib.bean.SQuery;
import com.gzwh.weblib.utils.MyObserver;

import org.json.JSONObject;

import java.util.List;
import java.util.Map;

import io.reactivex.Observable;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Query;

public interface ApiUrl {

    //获取系统标识号
    @Headers("Accept:application/json")
    @POST("admin/acl/login")
    Observable<Result<String>> getLogin(@Body RequestBody body);

    @GET("mobile/v2/store/storePrice")
    Observable<Result<Map<String, Object>>> storePrice(@Header("Token") String token);

    @GET("mobile/v2/store/getStore")
    Observable<Result<NzStore>> getStore(@Header("Token") String token);


    @GET("mobile/v2/product/getCategoryList")
    Observable<Result<List<NzProductCategory>>> getCategoryList(@Header("Token") String token);

    @GET("mobile/v2/dinner/qr/getAreList")
    Observable<Result<List<NzDinnerRegion>>> getAreList(@Header("Token") String token);

    @Headers("Accept:application/json")
    @POST("mobile/v2/dinner/qr/addAre")
    Observable<Result<String>> addAre(@Body RequestBody body, @Header("Token") String token);


    @Headers("Accept:application/json")
    @POST("mobile/v2/dinner/qr/deleteAre")
    Observable<Result<String>> deleteAre(@Body RequestBody body, @Header("Token") String token);

    @Headers("Accept:application/json")
    @POST("mobile/v2/dinner/qr/updateAre")
    Observable<Result<String>> updateAre(@Body RequestBody body, @Header("Token") String token);


    @GET("mobile/v2/store/getHome")
    Observable<Result<com.alibaba.fastjson.JSONObject>> getHome(@Header("Token") String token);


    @GET("mobile/v2/dinner/qr/getQrList")
    Observable<Result<List<NzDinnerQrcode>>> getQrList(@Header("Token") String token, @Query("areId") String areId);

    @GET("mobile/v2/product/getAttrList")
    Observable<Result<List<NzProductAttrModel>>> getAttrList(@Header("Token") String token);


    @GET("mobile/v2/product/getProductList")
    Observable<Result<JSONArray>> getProductList(@Header("Token") String token, @Query("categoryId") String areId);

//============================================================================


    //获取系统设备标识
    @GET("api/nizhou/getSysInfo")
    Observable<Result<Map<String, String>>> getSysInfo(@Header("X-Access-Verify") String verify, @Header("X-Access-ChannelId") String channelId);


    @GET("api/nizhou/getSysUser")
    Observable<Result<List<DinnerShopStaff>>> getSysUser(@Header("X-Access-Verify") String verify, @Header("X-Access-ChannelId") String channelId);

    @GET("api/nizhou/getMenuFoods")
    Observable<Result<DMenuModel>> getMenuFoods(@Header("X-Access-Verify") String verify, @Header("X-Access-ChannelId") String channelId);

    @POST("/api/P/sqb/micropay")
    Observable<Result<DMenuModel>> micropay(@Body RequestBody body);

    @POST("/api/P/sqb/query")
    Observable<Result<SQuery>> query(@Body RequestBody body);

    @POST("/api/P/sqb/channel/Add")
    Observable<Result<JSONObject>> addChannel(@Body RequestBody body);

    @POST("/api/P/sqb/query2")
    Observable<Result<PayCheckModel>> query2(@Body RequestBody body);

    @GET("dinner/api/handset/v1/order/getOrders")
    Observable<Result<List<DinnerOrderModel>>> getOrders(@Query("sysChannelId") String sysChannelId);

    @GET("/dinner/api/handset/v1/order/getMyOrderCS")
    Observable<Result<Map<String, String>>> getMyOrderCS(@Query("channelId") String channelId);

    @POST("/dinner/api/handset/v1/login")
    @FormUrlEncoded
    Observable<Result<String>> login(@Field("username") String userName, @Field("password") String password);


    //上报设备驱动
    @POST("dinner/api/handset/v1/regDevices")
    Observable<Result<String>> regDevices(@Body RequestBody body);

    //系统人员登录
    @POST("dinner/api/handset/v1/toLogin")
    Observable<Result<String>> toLogin(@Body RequestBody body);

    //操作员登录
    @POST("dinner/api/handset/v1/toLoginStaff")
    Observable<Result<String>> toLoginStaff(@Body RequestBody body);

    //获取菜品分类
    @GET("dinner/api/handset/v2/foodMenu/getFoodCategory")
    Observable<Result<List<DTreeCategoryModel>>> getFoodCategory(@Header("token") String token, @Query("menuId") String menuId);

    //添加分类
    @PUT("dinner/api/handset/v2/foodMenu/addFoodCategory")
    Observable<Result<String>> addFoodCategory(@Header("token") String token, @Query("name") String name, @Query("menuId") String menuId);


    //获取菜品
    @GET("dinner/api/handset/v2/foodMenu/getFood")
    Observable<Result<List<MenuFoodModel>>> getFood(@Header("token") String token, @Query("cateId") String cateId);

    @GET("dinner/api/handset/v2/foodMenu/countFoodNumByCategory")
    Observable<Result<List<CountCateToFoodModel>>> countFoodNumByCategory(@Header("token") String token, @Query("menuId") String menuId);

    @POST("dinner/api/handset/v2/foodMenu/saveCategorySort")
    Observable<Result<String>> saveCategorySort(@Header("token") String token, @Body RequestBody body);

    @POST("dinner/api/handset/v2/foodMenu/upFoodShowStatus")
    @FormUrlEncoded
    Observable<Result<List<MenuFoodModel>>> upFoodShowStatus(@Header("token") String token, @Field("foodId") String foodId);

    @DELETE("dinner/api/handset/v2/foodMenu/deleteFoodCategory")
    Observable<Result<String>> deleteFoodCategory(@Header("token") String token, @Query("id") String id);

    @POST("dinner/api/handset/v2/foodMenu/updateFoods")
    Observable<Result<String>> updateFoods(@Header("token") String token, @Body RequestBody body);

    @POST("dinner/api/handset/v2/foodMenu/updateStockBath")
    Observable<Result<String>> updateStockBath(@Header("token") String token, @Body RequestBody body);

    @POST("dinner/api/handset/v2/sysSet/updatePassword")
    @FormUrlEncoded
    Observable<Result<String>> updatePassword(@Header("token") String token, @Field("oldPassword") String oldPassword, @Field("newPassword") String newPassword);

}
